var express = require('express'),
    swig = require('swig-templates'),
    request = require('request'),
    wx = require('../base/wx'),
    sha1 = require('node-sha1'),
    crypto = require('crypto'),
    router = express.Router();

router.get('/',function(req, res,next) {
    wx.goAccessToken(req, res, function () {
        wx.getToken(req, function () {
            var getticket = JSON.parse(JSON.stringify(config.getticket));
            getticket.url = req.protocol + '://' + req.get('host') + req.originalUrl;
            getticket.signature = sha1(getticket.ticketStr + getticket.url);
            res.render('page/pay', {
                getticket: getticket
            });
        });
    });
});
module.exports = router;
